//
// Created by hy on 2018/8/29.
//
#include "hisleep.h"
#include <sys/time.h>
#include <stdio.h>
#include <sys/select.h>

void HiSleepUS(int usec)
{
    int sec = usec / 1000 / 1000;
    int us = usec - (sec * 1000 * 1000);
    timeval tval;
    tval.tv_sec = sec;
    tval.tv_usec = us;
    select(0, NULL, NULL, NULL, &tval);
}

void HiSleepMS(int msec)
{
    int sec = msec / 1000;
    int usec = (msec % 1000) * 1000;
    timeval tval;
    tval.tv_sec = sec;
    tval.tv_usec = usec;
    select(0, NULL, NULL, NULL, &tval);
}
